package model

import (
	"github.com/jinzhu/gorm"
	//"skynetcloud.com/develop/protos"
)

var (
	db *gorm.DB
)

//Init  初始化
func Init(dbConn *gorm.DB) {
	db = dbConn.Debug()

	AutoMigrate()
}

// GetPg 获取db连接
func getDB() *gorm.DB {
	return db.Debug()
}

//AutoMigrate 创建表
func AutoMigrate() {
	db.LogMode(true)

	db.AutoMigrate(&User{}) // User
	db.AutoMigrate(&Class{})
}
